home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-07-24 | 1.9 KB | 85 lines | [TEXT/MPS ] |
- UNIT WDef;
-
- INTERFACE
-
- USES MemTypes, QuickDraw, OSIntf, ToolIntf;
-
- {this is the only external routine}
- FUNCTION MyWindowDef(varCode: Integer; theWindow: WindowPtr; message: Integer;
- param: LongInt): LongInt; {As defined in IM p. I-299}
-
- IMPLEMENTATION
-
- FUNCTION MyWindowDef(varCode: Integer; theWindow: WindowPtr; message: Integer;
- param: LongInt): LongInt;
-
- TYPE
- RectPtr = ^Rect;
-
- VAR
- aRectPtr : RectPtr;
-
- {here are the routines that are dispatched to by MyWindowDef}
-
- PROCEDURE DoDraw(theWind: WindowPtr; DrawParam: LongInt);
- BEGIN {DoDraw}
- {Fill in the code!}
- END; {DoDraw}
-
- FUNCTION DoHit(theWind: WindowPtr; theParam: LongInt): LongInt;
- BEGIN {DoHit}
- {Code for this FUNCTION goes here}
- END; {DoHit}
-
- PROCEDURE DoCalcRgns(theWind: WindowPtr);
- BEGIN {DoCalcRgns}
- {Code for this PROCEDURE goes here}
- END; {DoCalcRgns}
-
- PROCEDURE DoGrow(theWind: WindowPtr; theGrowRect: Rect);
- BEGIN {DoGrow}
- {Code for this PROCEDURE goes here}
- END; {DoGrow}
-
- PROCEDURE DoDrawSize(theWind: WindowPtr);
- BEGIN {DoDrawSize}
- {Code for this PROCEDURE goes here}
- END; {DoDrawSize}
-
- {now for the main body to MyWindowDef}
- BEGIN { MyWindowDef }
- {case out on the message and jump to the appropriate routine}
- MyWindowDef := 0; {initialize the function result}
-
- CASE message OF
-
- wDraw: { draw window frame}
- DoDraw(theWindow,param);
-
- wHit: { tell what region the mouse was pressed in}
- MyWindowDef := DoHit(theWindow,param);
-
- wCalcRgns: { calculate structRgn and contRgn}
- DoCalcRgns(theWindow);
-
- wNew: { do any additional initialization}
- { we don’t need to do any}
- ;
-
- wDispose:{ do any additional disposal actions}
- { we don’t need to do any}
- ;
-
- wGrow: { draw window’s grow image}
- BEGIN
- aRectPtr := RectPtr(param);
- DoGrow(theWindow,aRectPtr^);
- END; {CASE wGrow}
-
- wDrawGIcon:{ draw Size box in content region}
- DoDrawSize(theWindow);
-
- END; {CASE}
- END; {MyWindowDef}
- END. {of UNIT}
-